package cn.gx.demo.controller;

import cn.gx.kevin.common.annotation.ApiDescript;
import cn.gx.kevin.common.ui.AjaxResult;
import cn.gx.kevin.common.user.ILoginUserContext;
import cn.gx.kevin.common.user.LoginUser;
import cn.gx.kevin.common.utils.SysConfigParams;
import cn.gx.kevin.domain.Menu;
import cn.gx.kevin.domain.User;
import cn.gx.kevin.service.IUserService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

@ApiDescript("系统首页")
@Controller
@RequestMapping(value = "/board")
public class PersonerController {

    @Autowired
    IUserService userService;

    @RequestMapping(value = "/page/{pageName}", method = RequestMethod.GET)
    public String page(@PathVariable("pageName") String pageName, HttpServletRequest request) throws Exception {
        if("info".equals(pageName)){
            String id = request.getParameter("id");
            User user = userService.get(id);
            JSONObject obj = new JSONObject();
            obj.put("id",user.getId());
            obj.put("userEmail",user.getUserEmail());
            obj.put("userPhone",user.getUserPhone());
            String entityJson = obj.toJSONString();
            request.setAttribute("entityJson",entityJson);
        }
        return "person/"+pageName;
    }

}
